﻿using MaterialDemo.Model.WorkFlowDTO;
using System;
using System.Collections.Generic;
using System.Text;

namespace MaterialDemo.IService.IWorkFlow
{
   public interface IWorkFlowService
    {
        /// <summary>
        /// 根据工作流实例发起人Id 分页获取工作流实例
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="totalCount"></param>
        /// <param name="userId"></param>
        /// <param name="isConsumable">true为耗材，false为非耗材</param>
        /// <returns></returns>
        List<WorkFlowInstanceOutput> LoadPageEntitiesByUserId(int pageIndex, int pageSize, out int totalCount, string userId,bool isConsumable);


        /// <summary>
        /// 根据工作流待审核人Id 分页获取工作流实例
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="totalCount"></param>
        /// <param name="nextReviewerId"></param>
        /// <param name="isConsumable">true为耗材，false为非耗材</param>
        /// <returns></returns>
        List<WorkFlowInstanceOutput> LoadPageEntitiesByReviewer(int pageIndex, int pageSize, out int totalCount, string nextReviewerId, bool isConsumable);

        /// <summary>
        /// 需要出库的工作流实例
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="totalCount"></param>
        /// <param name="selectInfo"></param>
        /// <param name="isConsumable">true为耗材，false为非耗材</param>
        /// <returns></returns>
        List<WorkFlowInstanceOutput> LoadPageEntitiesByKeeper(int pageIndex, int pageSize, out int totalCount, string selectInfo, bool isConsumable);


        /// <summary>
        /// 获取实例实体
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        WorkFlowInstanceOutput LoadInstanceEntitiy(int Id);

        /// <summary>
        /// 获取实例步骤表
        /// </summary>
        /// <returns></returns>
        List<WorkFlowInstanceStepOutput> LoadStepEntities(string instanceId);




        #region 耗材部分
        /// <summary>
        /// 耗材申请
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        bool ApplyConsumable(WorkFlowInstanceInput input);

        /// <summary>
        /// 撤销耗材申请
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        bool RevokeConsumable(int Id);

        /// <summary>
        /// 耗材批量出库
        /// </summary>
        /// <param name="arrInstance"></param>
        /// <returns></returns>
        bool OutpuConsumable(string arrInstance, string reviewerId);


        /// <summary>
        /// 主管耗材审核
        /// </summary>
        /// <param name="instanceId"></param>
        /// <param name="reviewerId"></param>
        /// <returns></returns>
        bool ReviewConsumable(string instanceId, string reviewerId, bool isPass, string reason);
        #endregion



        #region 非耗材部分
        /// <summary>
        /// 非耗材借出申请
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        bool ApplyEquipment(WorkFlowInstanceInput input);


        /// <summary>
        /// 非耗材借出审核
        /// </summary>
        /// <param name="instanceId"></param>
        /// <param name="reviewerId"></param>
        /// <returns></returns>
        bool ReviewEquipment(string instanceId, string reviewerId, bool isPass, string reason);


        /// <summary>
        /// 撤销非耗材申请
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        bool RevokeEquipment(int Id);

        /// <summary>
        /// 非耗材批量出库
        /// </summary>
        /// <param name="arrInstance"></param>
        /// <returns></returns>
        bool OutputEquipment(string arrInstance, string reviewerId);

        /// <summary>
        /// 非耗材归还
        /// </summary>
        /// <param name="arrInstance"></param>
        /// <param name="revieerId"></param>
        /// <returns></returns>
        bool ReturnEquipment(string arrInstance, string reviewerId);

        /// <summary>
        /// 获取已经借出的非耗材工作流实例
        /// </summary>
        /// <returns></returns>
        List<WorkFlowInstanceOutput> LoadPageIsLentEquipment(int pageIndex, int pageSize, out int totalCount, string selectInfo);
        #endregion



    }
}
